
<form class="checkoutform" action="{:U('insert')}" method="post">

      
   

      
  
     <div class="form-group">
      <label class="control-label">名称</label>
      <div>
         <input class="form-control" datatype="*" value="{$info.susername}" name="susername" type="text" placeholder="供货商名称">
      </div>
   </div>
      

      <div class="form-group">
      <label class="control-label">电话</label>
      <div>
         <input class="form-control" name="sphone" value="{$info.sphone}" type="text" placeholder="电话">
      </div>
   </div>
   
   
   
      <div class="form-group">
      <label class="control-label">地区</label>
      <div>
         <span id="areabox"></span>
      </div>
      
   </div>
   
   
   
   
   
      <div class="form-group">
      <label class="control-label">地址</label>
      <div>
         <input class="form-control" value="{$info.saddress}" name="saddress" type="text" placeholder="地址">
      </div>
   </div><div class="form-group">
      <label class="control-label">店名</label>
      <div>
         <input class="form-control" value="{$info.shopname}" name="shopname" type="text" placeholder="店名">
      </div>
   </div>
   <div class="form-group">
      
      <div><label class="control-label">百度地图坐标</label>
         <input class="form-control" value="{$info.baidumapX},{$info.baidumapY}" name="baidupoint" id="txtPoint" type="text" placeholder="百度地图坐标">
      </div>
   </div>
   
   
   
   
   
   <div class="form-group">
     <label class="control-label">　</label><div>
      <style type="text/css">
	  
#l-map{height:500px;}
#r-result{overflow-y:scroll; height:500px;}
</style>
      <div class="row">
      
      <div class="col-sm-6">
         <input class="form-control" id="txtCity" type="text" placeholder="输入城市名称">
      </div><div class="col-sm-4">
         <a href="##" onClick="getPoint();" class="btn btn-success">搜索</a>
      </div></div>
      
                  <div class="row" style="margin-top:12px; padding:15px;"><div class="col-sm-8" id="l-map"></div>
                  <div id="r-result" class="col-sm-4"></div></div></div>
                


      
      
      
            <script type="text/javascript">
// 百度地图API功能  

var map = new BMap.Map("l-map");            // 创建Map实例
	map.centerAndZoom(new BMap.Point(113.342754,23.653305), 8);
	map.enableScrollWheelZoom();
	
	
	
	var point = new BMap.Point({$info.baidupoint});
	var marker = new BMap.Marker(point);  // 创建标注
	map.addOverlay(marker);
	
	var local = new BMap.LocalSearch("东莞", {
	  renderOptions: {
		map: map,
		panel : "r-result", 
		autoViewport: true, 
		selectFirstResult: false
	  }, 
	  onResultsHtmlSet:function(container){
		  $(container).find('li').each(function(index, element) {
			  $(this).click(function(e) {
                
				document.getElementById("txtPoint").value=local.getResults().getPoi(index).point.lng + "," + local.getResults().getPoi(index).point.lat; 
            });
             
        });
		  //alert(local.getResults().getNumPois());
	  
	  }  
	});
		map.addEventListener("click",function(e){
		
		document.getElementById("txtPoint").value=e.point.lng + "," + e.point.lat; 
	});
function getPoint(){ 
	 
    var city = document.getElementById("txtCity").value;
	local.search(city);                 // 初始化地图,设置城市和地图级别。
	                            //启用滚轮放大缩小

}

</script>
      
      
      
   </div>
   
   
   
   
   
   
   
   
   
   
   
   
   

   <div class="form-group">
      <label class="control-label">联系人</label>
      <div>
         <input class="form-control" value="{$info.contacts}" name="contacts" type="text" placeholder="联系人">
      </div>
   </div>
   
   <div class="form-group">
      <label class="control-label">备注</label>
      <div>
         <input class="form-control" value="{$info.remark}" name="remark" type="text" placeholder="备注">
      </div>
   </div>
   
   
    <div class="form-group">
      <label class="control-label">封面图</label>
      <div>
         <input name="img_url" type="hidden" value="{$info.img_url}" /><img onclick="showImgBox(this);" src="<notempty name="info['img_url']">{:getThumbPath($info['img_url'])}<else/>__PUBLIC__/Admin/images/defaultimg.png</notempty>" id="img_url" height="40" />
      </div>
   </div>
   
   
   
      <div class="form-group">
      <label class="control-label">详细介绍</label>
      <div>
         <html:editor id="editor" name="introduction" type="UEDIT" style="height:400px; width:100%;">{$info.introduction}</html:editor>
      </div>
   </div>
        
 
    </form>








<script>
	
	$(document).ready(function(e) {
        
		<empty name="info['area']">
		$.ajax({
			url:"{:U('getRegion')}",
			data:"",
			type:"POST",
			dataType:"html",
			success: function(data){
				$('#areabox').html(data);
			}
		});
		
		<else/>
		
		
		$.ajax({
			url:"{:U('setRegion')}",
			data:"area={$info.area}",
			type:"POST",
			dataType:"html",
			success: function(data){
				$('#areabox').html(data);
			}
		});
		
		</empty>
    });
	function removnextAll(e){
		if($(e).next().length>0){
			removnextAll($(e).next());
			$(e).next().remove();
		}
	}
	function sendRegion(e){
		if(e.value>0){
			$.ajax({
			url:"{:U('getRegion')}",
			data:"fid="+e.value,
			type:"POST",
			dataType:"html",
				success: function(data){
					removnextAll(e);
					$(e).parent().append(data);
				}
		    });
	    }else{
		    removnextAll(e);
	    }
	    return false;
	}

</script>
